<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<%@include file="/WEB-INF/taglibs/common/taglibs.jsp"%>
<head>
<title><spring:message code="admin.transaction.createdatamappings.title" /></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<link rel="stylesheet" href="<c:url value="/css/styles.css"/>" />
<script src="<c:url value="/javascripts/jquery-1.4.4.js"/>"></script>
<script src="<c:url value="/javascripts/jquery.tablednd_0_5.js"/>"></script>
<script  language="javascript">
var original_ids="";
<c:forEach items="${original_ids}" var="item" varStatus="i">
original_ids+="${item}"+","	</c:forEach>

$(document).ready(function() {
	$("#table-1").tableDnD({
		onDragClass: "dragTableRow",

		});
 
});

function getIdsData(){
	 
	var table=$("#table-1");
	var row = 0;
    var rows = table[0].tBodies[0].rows;
    var orderStr="";
    for (var i=0; i<rows.length; i++) {
        orderStr += rows[i].id+",";
    }

    document.getElementById("imported_ids").value=orderStr;
    document.getElementById("original_ids").value=original_ids;
 
}

</script>
</head>

<body><%@include file="../top_menu.jsp"%>
<table width=100%>
	<tr>
		<td><%@include file="/WEB-INF/jsp/menu/admin_transaction_menu.jsp"%>
		<br />
		</td>
	</tr>
		<tr>
		<td><%@include file="/WEB-INF/jsp/include/messages.jsp"%>
		<br />
		</td>
	</tr>
</table>
<br />
<br />
<spring:message code="admin.transaction.createdatamappings.label.loadtransaction" />.
<br />
<form method="post" action="create_mapping.htm" onsubmit="getIdsData()">
	<input type="hidden"  name="original_ids"  id="original_ids" value=""/>
<input type="hidden"  name="imported_ids" id="imported_ids" value=""/>



	<table width=50% class="formTable">

		<tr class="formHeader">
			<td colspan="2"><spring:message code="admin.transaction.createdatamappings.label.loadtransactiondata" /></td>
		</tr>
		<tr><td colspan="2">${message }</td></tr>
		<c:if test="${!error}">
		<tr valign="top">
		<td>
		<table cellspacing="0" cellpadding="2" style="background-color: #ccc; width: 100%; border: 1px solid black">
				<c:forEach items="${original_ids}" var="ids" varStatus="i">
					<tr style="border-bottom: 1px solid black; height: 30px">
						<td style="border-bottom: 1px solid black;">
						<div>${ids}</div>
						</td>
					</tr>

				</c:forEach>
			</table>
		</td>
		<td>
		<table id="table-1" cellspacing="0" cellpadding="2"	style="background-color: #acc; border: 1px solid black; width: 100%;">
				<tbody>
					<c:forEach items="${imported_ids}" var="item" varStatus="i">
						<tr style="border-bottom: 1px solid black; height: 30px"
							id="${item}">
							<td style="border-bottom: 1px solid black;">${item}</td>
						</tr>

					</c:forEach>
				</tbody>
			</table>
			
		</td></tr>
		<tr class="buttonPanel">

			<td colspan="2"><input type="submit" class='ui-button ui-state-default ui-corner-all' value="<spring:message code="admin.transaction.createdatamappings.button.load" />" name="load" /><input
				type="submit" class='ui-button ui-state-default ui-corner-all' value="<spring:message code="admin.transaction.createdatamappings.button.cancel" />" name="cancel" /></td>
		</tr>
		</c:if>
	</table>

</form><%@include file="/WEB-INF/jsp/include/footer.jsp"%>
</body>
</html>